using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Zero.Entity.Models.Mapping
{
    public class CF_RoleMap : EntityTypeConfiguration<CF_Role>
    {
        public CF_RoleMap()
        {
            // Primary Key
            this.HasKey(t => t.RoleID);

            // Properties
            this.Property(t => t.RoleID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.RoleName)
                .HasMaxLength(50);

            this.Property(t => t.RoleDesc)
                .HasMaxLength(100);

            this.Property(t => t.CreateUserID)
                .HasMaxLength(50);

            this.Property(t => t.ModifyUserID)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("CF_Role");
            this.Property(t => t.RoleID).HasColumnName("RoleID");
            this.Property(t => t.RoleName).HasColumnName("RoleName");
            this.Property(t => t.RoleDesc).HasColumnName("RoleDesc");
            this.Property(t => t.CreateUserID).HasColumnName("CreateUserID");
            this.Property(t => t.CreateDate).HasColumnName("CreateDate");
            this.Property(t => t.ModifyUserID).HasColumnName("ModifyUserID");
            this.Property(t => t.ModifyDate).HasColumnName("ModifyDate");
            this.Property(t => t.IsEnable).HasColumnName("IsEnable");
            this.Property(t => t.OrderIndex).HasColumnName("OrderIndex");
            
        }
    }
}
